#ifndef USERSQL_H
#define USERSQL_H

#include <modifyuserdialog.h>
#include <addfirstinfo.h>
#include <addinfo.h>
#include <modfirstinfo.h>
#include <modinfo.h>
#include <viewfirstinfo.h>
#include <viewinfo.h>

#include <QMainWindow>
#include <QTreeWidgetItem>
#include <QSqlDatabase>
#include <QSqlQueryModel>
#include <QPushButton>
#include <QImage>
#include <QtCore>

struct User
{
    int id;
    QString name;
    QString sex;
    QString idcard;
    QString address;
    QString phone;
};

struct Info
{
    int id = 0;
    int pid = 0;
    QString visit_time = "";
    QString first_symptom = "";
    int age = 0;
    QString elapsed_time = "";
    QString height = "";
    QString weight = "";
    QString smoking_history = "";
    QString previous_illnesses = "";
    QString comorbidity = "";
    QString thymic_disease = "";
    QString myasthenia = "";
    QString antibody_test = "";
    QString blood_test = "";
    QString technical_inspection = "";
    QString scale_evaluation1 = "";
    QString scale_evaluation2 = "";
    QString diagnosis1 = "";
    QString diagnosis2 = "";
    QString treatment_plan = "";
    QString MGFA = "";
};

namespace Ui {
class userSql;
}

class userSql : public QMainWindow
{
    Q_OBJECT

public:
    explicit userSql(QWidget *parent = 0);
    load(User user);
    load(Info info);
    load(QList<Info> list);
    ~userSql();

private slots:
    void on_treeWidget_itemClicked(QTreeWidgetItem *item, int column);

    void on_btn_mod_clicked();

    void on_btn_exit_clicked();

//    void on_tableWidget_clicked(const QModelIndex &index);

    //控制下表的量表的评估
    void clickButton1();

    //控制上表的量表的评估
    void clickButton2();

    //控制下表的技检
    void clickButton_tec1();

    //控制上表的技检
    void clickButton_tec2();

    //控制下表的血检
    void clickButton_blood1();

    //控制上表的血检
    void clickButton_blood2();

    //控制下表的抗体检
    void clickButton_antibody1();

    //控制上表的抗体检
    void clickButton_antibody2();

    //控制下表的诊断
    void clickButton_diagnosis1();

    //控制上表的诊断
    void clickButton_diagnosis2();

    void on_btn_remove_clicked();

    void on_tableWidget1_clicked(const QModelIndex &index);

    void on_tableWidget2_clicked(const QModelIndex &index);

    void on_btn_add_info_clicked();

    void on_btn_del_info_clicked();

    void on_btn_add_first_info_clicked();

    void on_btn_update_clicked();

    void on_btn_firstmod_clicked();

    void on_btn_mod_2_clicked();

    void on_btn_view_first_info_clicked();

    void on_btn_view_info_clicked();

public:
    QString getUserSqlId();
    addFirstInfo af;
    addInfo ai;

private:
    Ui::userSql *ui;
    modifyUserDialog mod_User;
    modFirstInfo mfi;
    modInfo mi;
    viewFirstInfo vfi;
    viewInfo vi;
    QSqlDatabase db;
    QSqlQueryModel *qmodel;
    QPushButton *button;
};

#endif // USERSQL_H
